# 双层语法糖
def outer1(func):
    print('from outer1')

    def inner1(*args, **kwargs):
        print('from inner1')
        res = func(*args, **kwargs)
        return res

    return inner1


def outer2(func):
    print('from outer2')

    def inner2(*args, **kwargs):
        print('from inner2')
        res = func(*args, **kwargs)
        return res

    return inner2


def outer3(func):
    print('from outer2')

    def inner3(*args, **kwargs):
        print('from inner2')
        res = func(*args, **kwargs)
        return res

    return inner3


# @装饰器 语法糖 实现了 index = outer(index)
@outer3  # index = outer2(inner2) = inner3
@outer2  # inner2 = outer2(inner1)
@outer1  # inner1=outer1(index)
def index():
    print('from index')


index()  # inner3() -> inner2() -> inner1() -> index()


